<template>
	<div style="width: 100%; height: 100%; position: relative;">
		<div class="container">
			<el-table border :data="tableData" style="width: 100%" :default-sort="{prop: 'date', order: 'descending'}">
				<el-table-column prop="date" label="日期" sortable width="180">
				</el-table-column>
				<el-table-column prop="username" label="购买人" sortable width="180">
				</el-table-column>
				<el-table-column prop="user_phone" label="电话" sortable width="180">
				</el-table-column>
				<el-table-column prop="name" label="名称" width="240">
				</el-table-column>
				<el-table-column prop="num" label="数量" sortable width="180">
				</el-table-column>
				<el-table-column prop="goods_price" label="金额" sortable width="180">
				</el-table-column>
			</el-table>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				tableData: []
			};
		},
		created() {
			let _id = '6625e7c9fe975f74409546d6'
			let col = uniCloud.importObject('nyPictureIndentObj', {
				customUI: true
			})
			let alltag = []
			col.loopictureIndentall({
				"schedule": '已完成'
			}).then((res) => {
				console.log(res.data)
				res.data.map((n, m) => {
					let date = n.create_date
					this.tableData.push({
						"date": `${date[0]}${date[1]}${date[2]}${date[3]}-${date[4]}${date[5]}-${date[6]}${date[7]}`,
						"username": n.username,
						"user_phone": n.user_phone,
						"name": n.goodsname,
						"num": n.goods_num,
						"goods_price": n.goods_price*0.01,
						"_id": n._id
					})
				})
			})


		},
		methods: {
			formatter(row, column) {
				return row.address;
			}
		}
	}
</script>

<style lang="scss">
	.container {
		margin: 0;
		padding: 0;
		background-color: #fff;
		width: 100%;
		height: 97%;
		overflow-y: auto;
		overflow-x: hidden;

	}
</style>